from pyecharts import options as opts
from pyecharts.charts import Bar

def draw_bar(all_list):
    print("开始绘图")
    attr = ["海沧", "湖里", "集美", "思明", "翔安", "同安"]
    v0 = all_list[0]
    v1 = all_list[1]
    v2 = all_list[2]
    v3 = all_list[3]

    bar = (
        Bar()
        .add_xaxis(attr)
        .add_yaxis("最小值", v0, label_opts=opts.LabelOpts(is_show=True))
        .add_yaxis("最大值", v1, label_opts=opts.LabelOpts(is_show=True))
        .add_yaxis("平均值", v2, label_opts=opts.LabelOpts(is_show=True))
        .add_yaxis("中位数", v3, label_opts=opts.LabelOpts(is_show=True))
        .set_global_opts(title_opts=opts.TitleOpts(title="厦门市租房租金概况"))
    )
    bar.render()
    print("结束绘图")


